package com.myway.core.common;

import java.util.HashMap;


/**
 * 类名称：RfdAutoApproveStatus
 * 类描述 :	 自动审核日志信息状态
 * 创建时间：2016-6-14 下午9:05:20
 * @author hongjun.quan
 * @version V1.0
 */
public enum AutoRfdApproveStatus {

	AAC("AAC"),	//自动审批成功 	automatic approve success
	AAE("AAE"),	//自动审批失败 	automatic approve error
	WAE("WAE"), //工作流审批失败	workFlow approve error
	NMO("NMO");	//需要手动操作	need manual operation
	/**
	 * Alias name. This is the name which will be stored in database.
	 */
	private final String alias;

	/**
	 * A hash map which keep all the action enum with alias name as key.
	 */
	private static HashMap<String, AutoRfdApproveStatus> map;

	/**
	 * Construct the hash map at load time
	 */
	static {
		map = new HashMap<String, AutoRfdApproveStatus>();
		for (AutoRfdApproveStatus type : AutoRfdApproveStatus.values()) {
			map.put(type.alias, type);
		}
	}

	AutoRfdApproveStatus(String alias) {
		this.alias = alias;
	}

	@Override
	public String toString() {
		return this.alias;

	}

	/**
	 * Return a <code>Action</code> object holding the value of specified alias
	 * name
	 * 
	 * @param alias
	 *            the alias name of the type
	 * @return a <code>Action</code> object holding the value represented by the
	 *         alias name argument
	 */
	public static AutoRfdApproveStatus valueOfAlias(String alias) {
		AutoRfdApproveStatus type = map.get(alias);

		if (type == null) {
			throw new IllegalArgumentException("Unknown action alias [" + alias + "]");
		}

		return type;
	}

	/**
	 * @return the alias
	 */
	public String getAlias() {
		return this.alias;
	}

}
